#/bin/sh

if [ ! $# -eq 1 ];then
	echo "arguments error, usage: ./translate.sh 'word'"
	exit 1
fi

url="http://openapi.baidu.com/public/2.0/bmt/translate?client_id=MfYsZRP9IdLcMx1TBnCUD9aS&q="$1"&from=auto&to=auto"

ret=`lynx -dump $url | awk -F '"' '{print $18}'`

python -c 'source=u"'$ret'";print source'
